package o;

import android.content.Context;
import android.view.ViewGroup;
import androidx.fragment.app.Fragment;
import androidx.fragment.app.FragmentActivity;
import com.huawei.appgallery.appcomment.api.IUserCommentListFragmentProtocol;
import com.huawei.appgallery.forum.base.https.jgw.JGWTabInfo;
import com.huawei.appgallery.forum.user.api.IUserHomePageProtocol;
import java.util.List;

public class cbw extends SomeFragmentStateAdapter {
    private String ʻ;
    private Context ˊ;
    private String ˎ;
    private Fragment ˏ;
    private List<JGWTabInfo> ॱ = null;

    public cbw(FragmentManager juVar, Context context) {
        super(juVar);
        this.ˊ = context;
    }

    public Fragment getItem(int i) {
        return ˎ(((JGWTabInfo) this.ॱ.get(i)).ʼ());
    }

    private Fragment ˎ(String str) {
        if ("forum|user_detail_review".equals(str)) {
            fjb ˎ = fho.ˏ().ˋ("AppComment").ˎ("UserCommentListFragment");
            ((IUserCommentListFragmentProtocol) ˎ.ˊ()).setUserId(this.ˎ);
            return fjm.ˏ(fiu.ˊ().ˋ(this.ˊ, ˎ)).ˏ();
        }
        if ("forum|user_detail_favorite".equals(str)) {
            ˎ = fho.ˏ().ˋ("User").ˎ("UserHomeTabFavoriteFragment");
        } else {
            ˎ = fho.ˏ().ˋ("User").ˎ("UserHomeTabFragment");
        }
        IUserHomePageProtocol iUserHomePageProtocol = (IUserHomePageProtocol) ˎ.ˊ();
        iUserHomePageProtocol.setUri(cbu.ॱ(str, this.ˎ));
        iUserHomePageProtocol.setDomainId(this.ʻ);
        iUserHomePageProtocol.setIsDelayShowLoading(true);
        iUserHomePageProtocol.setNoObserverAccount(true);
        fjm ˏ = fjm.ˏ(fiu.ˊ().ˋ(this.ˊ, ˎ));
        FragmentTransaction ˊ = ((FragmentActivity) this.ˊ).ˏॱ().ˊ();
        ˊ.ˏ(ˏ.ˏ());
        ˊ.ˏ();
        return ˏ.ˏ();
    }

    public int getCount() {
        if (this.ॱ == null || this.ॱ.size() <= 0) {
            return 0;
        }
        return this.ॱ.size();
    }

    public void setPrimaryItem(ViewGroup viewGroup, int i, Object obj) {
        super.setPrimaryItem(viewGroup, i, obj);
        Fragment fragment = (Fragment) obj;
        if (fragment != this.ˏ) {
            if (fragment instanceof ciy) {
                ((ciy) fragment).ˋ(i);
            }
            if (this.ˏ instanceof ciy) {
                ((ciy) this.ˏ).ʽˊ();
            }
            this.ˏ = fragment;
        }
    }

    public Fragment ॱ() {
        return this.ˏ;
    }

    public void ॱ(List<JGWTabInfo> list) {
        this.ॱ = list;
    }

    public void ˏ(String str) {
        this.ˎ = str;
    }

    public void ॱ(String str) {
        this.ʻ = str;
    }
}
